package com.example.businessserver.dao;


import com.example.businessserver.entities.Business;
import com.example.server_engineer.dao.AbstractDao;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.util.Optional;


/**
 * @author Administrator
 */
public interface BusinessDao
        extends AbstractDao<Business, Integer> {

    Optional<Business> findBusinessByName(String businessName);
    Optional<Business> findBusinessById(Integer businessId);

    @Modifying
    @Transactional
    @Query(value = "update business set img=? where id=?",nativeQuery = true)
    Integer updateImgByBusinessId(String img,Integer id);
}
